package net.guerlab.smart.platform.user.core.searchparams;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import net.guerlab.spring.searchparams.AbstractSearchParams;
import net.guerlab.spring.searchparams.OrderByType;
import net.guerlab.spring.searchparams.SearchModel;
import net.guerlab.spring.searchparams.SearchModelType;

import javax.persistence.Column;
import java.time.LocalDateTime;

/**
 * 登录记录搜索参数
 *
 * @author guer
 */
@Setter
@Getter
@ApiModel("登录记录搜索参数")
public class LoginLogSearchParams extends AbstractSearchParams {

    /**
     * 用户ID
     */
    @ApiModelProperty("用户ID")
    private Long userId;

    /**
     * 姓名关键字
     */
    @ApiModelProperty("姓名关键字")
    @SearchModel(SearchModelType.LIKE)
    @Column(name = "name")
    private String nameLike;

    /**
     * 登录身份
     */
    @ApiModelProperty("登录身份")
    private String loginIdentity;

    /**
     * 登录方式
     */
    @ApiModelProperty("登录方式")
    private String loginType;

    /**
     * 登录时间开始范围
     */
    @ApiModelProperty("登录时间开始范围")
    @Column(name = "loginTime")
    @SearchModel(SearchModelType.GREATER_THAN_OR_EQUAL_TO)
    private LocalDateTime loginTimeStartWith;

    /**
     * 登录时间结束范围
     */
    @ApiModelProperty("登录时间结束范围")
    @Column(name = "loginTime")
    @SearchModel(SearchModelType.LESS_THAN_OR_EQUAL_TO)
    private LocalDateTime loginTimeEndWith;

    /**
     * 登录IP
     */
    @ApiModelProperty("登录IP")
    private String loginIp;

    /**
     * 登录成功标志
     */
    @ApiModelProperty("登录成功标志")
    private Boolean success;

    /**
     * 登录失败原因关键字
     */
    @ApiModelProperty("登录失败原因关键字")
    @SearchModel(SearchModelType.LIKE)
    @Column(name = "reason")
    private String reasonLike;

    /**
     * 登录记录ID排序方式
     */
    @ApiModelProperty(hidden = true)
    @JsonIgnore
    @Column(name = "loginLogId")
    private OrderByType loginLogIdOrderByType = OrderByType.DESC;
}
